// navbar.js
// 获取应用实例
const App = getApp();
Component({
  properties: {
    title: {
      type: String,
      value: '新视界'
    },
    background: {
      type: String,
      value: 'linear-gradient(to right,#FF3413,#FF924D)'
    },
    isSowArrow: {
      type: Boolean,
      value: true
    }
  },
  data: {
    capsuleTop: '', //胶囊距离屏幕顶部的距离
    capsuleHeight: '', //胶囊高度
    navbarHeight: '' //导航栏高度
  },
  attached: function () {
    this.setData({
      capsuleTop: App.globalData.capsule.top,
      capsuleHeight: App.globalData.capsule.height,
      navbarHeight: (App.globalData.capsule.top - App.globalData.system.statusBarHeight) * 2 + App.globalData.capsule.height + App.globalData.system.statusBarHeight,
    });
    //将实际nav高度传给父类页面
    this.triggerEvent('getNavHeight', {
      height: (App.globalData.capsule.top - App.globalData.system.statusBarHeight) * 2 + App.globalData.capsule.height + App.globalData.system.statusBarHeight
    });
  },
  methods: {
    handleGoToBack() {
      wx.navigateBack({
        delta: 1
      })
    }
  }
})